本文共 5079 字,大约阅读时间需要 16 分钟。
对于SNS网站来说,都少不了有用户头像上传、配置的功能,面临大量用户的情况,如何维护头像图片服务器?这里,我推荐一个我刚刚发现的头像管理的网站,提供功能强大的插件功能。
返回的数据可以有多种格式:XML、Json、PHP、VCcard等
简单看下返回的JSON格式数据:
1. 创建一个可用的
2. 创建一个 url地址
3. 将上面的url地址 命名为 .json
最后,生成的请求用户图片的url路径地址如下面形式:
示例:
<script type="text/javascript">
function changeTitle( profile ) { document.title = profile.entry[0].displayName;}</script><script src="" type="text/javascript"></script>
返回的数据如下:
changeTitle({"entry":[{"id":"1428","hash":"205e460b479e2e5b48aec07710c08d50","requestHash":"205e460b479e2e5b48aec07710c08d50","profileUrl":"http:gravatar.com//beau","preferredUsername":"beau","thumbnailUrl":"http:0.gravatar.com//avatar//205e460b479e2e5b48aec07710c08d50","photos":[{"value":"http:0.gravatar.com//avatar//205e460b479e2e5b48aec07710c08d50","type":"thumbnail"},{"value":"http:0.gravatar.com//userimage//1428//75ad2fafd20dd9302f42b0a02d51e860"},{"value":"http:0.gravatar.com//userimage//1428//9564d785bb3d64c03d26b2de426c4312"},{"value":"http:1.gravatar.com//userimage//1428//a5d0e4d405a047e5b567e488dbc1eb21"},{"value":"http:1.gravatar.com//userimage//1428//feb73c66a51313817aad85ebaba82ba3"}],"profileBackground":{"color":"#267817","position":"left","repeat":"repeat","url":"http:1.gravatar.com//bg//1428//61e2c0ec1394308ed63118fa7c30230a"},"name":{"givenName":"Beau","familyName":"Lebens","formatted":"Beau Lebens"},"displayName":"Beau Lebens","aboutMe":"I'm a Code Wrangler at Automattic and work on Gravatar , IntenseDebate , WordPress.com and once in a while WordPress.org . I love my job. I've been coding in PHP for around 10 years and working with HTML for almost 14./n/nWhen I'm not working, I'm an avid practitioner of Krav Maga and love camping//hiking when I get the chance. I live in San Francisco, which is, IMHO, one of the best cities in the world. I grew up in Australia, but haven't lived there for 6 years now.","currentLocation":"San Francisco, CA, USA","phoneNumbers":[{"type":"mobile","value":"14152790783"}],"emails":[{"primary":"true","value":"beau@dentedreality.com.au"}],"ims":[{"type":"aim","value":"beaulebens"},{"type":"msn","value":"beau@dentedreality.com.au"},{"type":"yahoo","value":"beaulebens"},{"type":"icq","value":"798818"},{"type":"gtalk","value":"beau.lebens@gmail.com"},{"type":"skype","value":"borkazoid"}],"accounts":[{"domain":"blogger.com","display":"blogger.com","url":"http:www.blogger.com//profile//16955909532360216492","userid":"16955909532360216492","verified":"true","shortname":"blogger"},{"domain":"facebook.com","display":"beaulebens","url":"http:www.facebook.com//beaulebens","username":"beaulebens","verified":"true","shortname":"facebook"},{"domain":"flickr.com","display":"borkazoid","url":"http:www.flickr.com//people//borkazoid//","username":"borkazoid","verified":"true","shortname":"flickr"},{"domain":"friendfeed.com","display":"beaulebens","url":"http:friendfeed.com//beaulebens","username":"beaulebens","verified":"true","shortname":"friendfeed"},{"domain":"foursquare.com","display":"foursquare.com","url":"http:foursquare.com//user//-3277","userid":"-3277","verified":"true","shortname":"foursquare"},{"domain":"linkedin.com","display":"beaulebens","url":"http:www.linkedin.com//in//beaulebens","username":"beaulebens","verified":"true","shortname":"linkedin"},{"domain":"myspace.com","display":"beaulebens","url":"http:www.myspace.com//beaulebens","username":"beaulebens","verified":"true","shortname":"myspace"},{"domain":"posterous.com","display":"beau","url":"http:beau.posterous.com","username":"beau","verified":"true","shortname":"posterous"},{"domain":"tripit.com","display":"beaulebens","url":"http:tripit.com//people//beaulebens","username":"beaulebens","verified":"true","shortname":"tripit"},{"domain":"tumblr.com","display":"beaulebens","url":"http:beaulebens.tumblr.com//","username":"beaulebens","verified":"true","shortname":"tumblr"},{"domain":"twitter.com","display":"@beaulebens","url":"http:twitter.com//beaulebens","username":"beaulebens","verified":"true","shortname":"twitter"},{"domain":"vimeo.com","display":"beau","url":"http:vimeo.com//beau","username":"beau","verified":"true","shortname":"vimeo"},{"domain":"dentedreality.com.au","display":"dentedreality.com.au","url":"http:dentedreality.com.au//","username":"dentedreality.com.au","verified":"true","shortname":"wordpress"},{"domain":"profiles.yahoo.com","display":"profiles.yahoo.com","url":"http:profiles.yahoo.com//u//V7GX4AZFSTGGD3RRBWIBWEP7Z4","userid":"V7GX4AZFSTGGD3RRBWIBWEP7Z4","verified":"true","shortname":"yahoo"},{"domain":"youtube.com","display":"beaulebens","url":"http:www.youtube.com//user//beaulebens","username":"beaulebens","verified":"true","shortname":"youtube"}],"urls":[{"value":"http:dentedreality.com.au","title":"Dented Reality"},{"value":"http:intensedebate.com","title":"IntenseDebate"},{"value":"http:wordpress.com","title":"WordPress.com"},{"value":"http:automattic.com","title":"Automattic"},{"value":"http:gravatar.com","title":"Gravatar"},{"value":"http:mybabyourbaby.com","title":"MyBabyOurBaby.com"}]}]});
另外,将网站与Google结合,用 登录的,您只需在 Google 上设置您的头像就可以了。
应用实例:
转载地址:http://tykvi.baihongyu.com/